#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
	int a = 0, b = 0, arr1[10] = { 0 }, arr2[10] = { 0 };
	for (a = 0;a < 10;a++)
	{
		scanf("%d", &arr1[a]);
	}
	for (a = 0;a < 10;a++)
	{
		scanf("%d", &arr2[a]);
	}
	for (a = 0;a < 10;a++)
	{
		b = arr1[a];
		arr1[a] = arr2[a];
		arr2[a] = b;
	}
	for (a = 0;a < 10;a++)
	{
		printf("%d ", arr1[a]);
	}
	printf("\n");
	for (a = 0;a < 10;a++)
	{
		printf("%d ", arr2[a]);
	}
	printf("\n");
	return 0;
}